package cn.com.dcsgo.library.admin.domain.request;

import cn.com.dcsgo.library.admin.domain.po.BookCopies;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.LinkedList;
import java.util.List;

/**
 * @author Dcsgo
 * @since 2024/9/9 14:44
 */
@Data
public class AddBookCopiesRequest {
    @ApiModelProperty("图书编号")
    private Long bookId;

    @ApiModelProperty("要添加的复本数量")
    private Long quantity;

    public List<BookCopies> toBookCopiesList() {
        LinkedList<BookCopies> copies = new LinkedList<>();
        for (int i = 0; i < quantity; i++) {
            BookCopies copy = new BookCopies();
            copy.setBookId(bookId);
            copies.add(copy);
        }
        return copies;
    }
}
